using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FX.Data;
using Warranty.Core;
using Warranty.Core.IService;
using Warranty.Core.Domain;
using NHibernate;

namespace Warranty.Core.ServiceImp
{
    public class DeliveryNoteService: BaseService<DeliveryNote ,int>,IDeliveryNoteService
    {
        ISession _mySession;
        public DeliveryNoteService(string sessionFactoryConfigPath)
            : base(sessionFactoryConfigPath)
        {}
        public void AddOrUpdate(DeliveryNote hs)
        {
            using (_mySession = NHibernateSession.SessionFactory.OpenSession())
            {
                if (hs.ID > 0)
                    _mySession.Update(hs);
                else
                    CreateNew(hs);
                CommitChanges();
                _mySession.Flush();
            }
        }
    }

}